<template>
  <div class="footer">
    <h1>我是Footer</h1>
    <p>Count的值是{{ count }}+{{ price }}</p>
    <button @click="getmoveList">获取数据</button>
    <ul>
      <li v-for="item in movieList" :key="item.tvId">{{ item.albumName }}</li>
    </ul>
    <hr />
    <ul>
      <li v-for="item in mymoveList" :key="item.tvId">{{ item.albumName }}</li>
    </ul>
    <ul>
      <li v-for="item in yourmovieList" :key="item.tvId">{{ item.albumName }}</li>
    </ul>
    <hr />
  </div>
</template>

<script>
import { mapActions, mapGetters, mapState } from "vuex";
export default {
  name: "Footer",
  computed: {
    count() {
      return this.$store.state.count;
    },
    price() {
      return this.$store.state.price;
    },

    ...mapState(["movieList"]),
    //mapState可以自动拿到实例里面的$store 然后在找到state 然后再找到对应的里面的count和price 并将其返回出来 ，且因为computed中的是对象，所有需要使用...将map中的数据以对象形式展开。
    // ...mapState(["count","price"])

    ...mapGetters(["mymoveList"]),

    yourmovieList(){
        return   this.$store.getters.yourmovieList({n:2,m:4})
    }
  },

  methods: {
    ...mapActions(["getmoveList"]),
  },
};
</script>

<style scoped>
.footer {
  margin: 30px;
  background: palevioletred;
}
</style>